from unit_02.Base.Base import Base
from selenium.webdriver.common.by import By
import time



class Page(Base):
    # 定位元素
    # 封装操作的元素的方法
    # 1.点击请登录 class="headerLogin"
    qdl_loc=(By.CLASS_NAME,'headerLogin')
    def click_qdl(self):
        self.click(self.qdl_loc)
    # 2.输入账号 id="userName"方法
    phone_loc=(By.ID,'userName')
    def sr_phone(self):
        self.send_keys(self.phone_loc,'18185603008')
    # 3.输入密码 id="password"
    pwd_loc=(By.ID,'password')
    def sr_pwd(self):
        self.send_keys(self.pwd_loc,'123456Aa')
    # 4.点击登录 name="bi_Usuallogin"
    login_loc=(By.NAME,'bi_Usuallogin')
    def click_login(self):
        self.click(self.login_loc)
    # 5.点击确定 id="bindSub"
    queding_loc=(By.ID,'bindSub')
    def click_queding(self):
        self.click(self.queding_loc)
    # 断言 /html/body/div[2]/div/div[1]/div/p/span

    # 酒仙登录逻辑
    def login_luoji(self):
        self.open_url('https://www.jiuxian.com/')
        time.sleep(2)
        # 1.点击请登录
        self.click_qdl()
        time.sleep(2)
        # 2.输入账号
        self.sr_phone()
        time.sleep(2)
        # 3.输入密码
        self.sr_pwd()
        # 强制等待
        time.sleep(10)
        # 4.点击登录
        self.click_login()
        time.sleep(2)
        # 5.点击确定
        self.click_queding()



